import { ParamValueType } from '../dto/expression.ts';
import { ParamTypeEnum } from '../dto/enumeration.ts';

/**
 * 解析参数类型
 * @param value
 */
export function parseParamType(
  value: ParamValueType,
): ParamTypeEnum | string {
  const valType = typeof value;
  switch (valType) {
    case 'string':
      return ParamTypeEnum.STRING;
    case 'number':
      return ParamTypeEnum.NUMBER;
    case 'boolean':
      return ParamTypeEnum.BOOL;
    case 'object':
      return ParamTypeEnum.OBJECT;
  }
  return valType;
}
